package org.jks.service;

import java.util.List;

import org.jks.model.AttachmentGroup;
import org.springframework.stereotype.Service;

@Service
public class AttachmentGroupService extends EntityService<AttachmentGroup>{
	
	public AttachmentGroupService(){
		MODEL_NAME = AttachmentGroup.class.getSimpleName();
		CLASS_NAME = AttachmentGroup.class;
	}
	
	public AttachmentGroup findByName(String name){
		String hql = "from " + MODEL_NAME + " where Name='" + name + "'";
		List<AttachmentGroup> attachmentGroups = super.find(hql);
		if(attachmentGroups == null || attachmentGroups.size() == 0)
		{
			return null;
		}
		return attachmentGroups.get(0);
	}

}
